<template>
  <view class="search-container" :style="{ 'background-color': bgcolor }">
   <view class="search-box" @click="toSearch">
      <uni-icons type="search" size="18"></uni-icons>
      <text>搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    data() {
      return {
        
      };
    },
    
    // 子组件接受父组件传递的参数
    props: {
      bgcolor: {
        type: String,
        default: '#c00000'
      }
    },
    
    methods: {
      toSearch() {
        uni.navigateTo({
          url: '/subpkg/search/search'
        })
      }
    }
  }
</script>

<style lang="scss">
.search-container {
  height: 50px;
  // background-color: #07c05c;
  display: flex;
  align-items: center;
  padding: 0 10px;
  .search-box {
    height: 40px;
    background-color: #fff;
    width: 100%;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text {
      font-size: 14px;
      margin-left: 5px;
    }
  }
}
</style>